<style>
    /*表头*/
    table thead {
        z-index: 2;
        position: sticky;
        position: -webkit-sticky;
        top: 0;
        background: #f4f4f4;
    }
    table thead tr th:first-child{
        position: sticky;
        top: 0;
        left: 0;
        background: #f4f4f4;
    }
    th:nth-child(2){
        position: sticky;
        left: 72px;
        background: #f4f4f4;
    }
    th:nth-child(3){
        position: sticky;
        left: 115px;
        background: #f4f4f4;
    }

    /*表格*/
    table tbody tr td:first-child {
        z-index: 1;
        position: sticky;
        position: -webkit-sticky;
        left: 0;
        background: #f4f4f4;
    }
    td:nth-child(2){
        position: sticky;
        left: 72px;
        background: #f4f4f4;
    }
    td:nth-child(3){
        position: sticky;
        left: 115px;
        background: #f4f4f4;
    }
</style>

<table class="table table-hover">
    <thead>
    <tr>
        @foreach($headers as $filed => $item)
        <th>{{ $item['title'] }}</th>
        @endforeach
    </tr>
    <tr style="color:#f56f9c">
        @foreach($headers as $filed => $item)
            @if($filed == 'account')
                <td style="position: sticky; top: 0; left: 0; background: #f4f4f4;">TTL</td>
            @elseif($item['sumField'])
                <td>{{ array_key_exists($filed,$total) ? $total[$filed] : '' }}</td>
            @else
                <td></td>
            @endif
        @endforeach
    </tr>
    </thead>
    <tbody>
    @foreach($paginator as $row)
        <tr>
            <td>{{ \App\Models\Basics\SysPlatAccount::getPlatAccount($row->account_id) ?? '' }}</td>
            <td>{{ \App\Models\Basics\SysPlat::$_platformType[$row->plat_id] ?? ''  }}</td>
            <td>{{ $row->area->area ?? '' }}</td>
            <td>{{ $row->country->country ?? '' }}</td>
            @for($i = \App\Models\SalesReport\MonthlySa::V_NUM - 1; $i >= 0; $i--)
                <td>{{ $row->{'month'.$i} }}</td>
            @endfor
        </tr>
    @endforeach
    </tbody>
</table>
